const { ref } = Vue
import { useFetch } from '../../../Scripts/hooks/useFetch.js'

export function useUnReceiveData() {
  let notReceivedList = ref([]);//【待接收】数据
  let unReceiveDataRows = ref(0);//【待接收】总数
  // 查询待检验数据
  const getUnReceivedData = async configObj => {
    const { data, total } = await useFetch({
      url: `${configObj.url}?actions=${configObj.method}`,
      data: {
        ...configObj,
        type: `${configObj.method}`,
        factoryid: configObj.factoryid,
        workerid: configObj.workerid
      }
    });
    notReceivedList.value = data.value;
    unReceiveDataRows.value = total;
  }

  return {
    notReceivedList, unReceiveDataRows,
    getUnReceivedData
  }
}